<!doctype html>
<html lang="en" ng-app="phonecatApp">
   <head>
     <title>CP</title>
     <meta http-equiv=Content-Type content="text/html" charset='utf-8'>
     <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
     <meta content="yes" name="apple-mobile-web-app-capable">
     <meta content="telephone=no" name="format-detection">
     </head>
<body>

  <div ng-view></div>

</body>
     <script src="http://127.0.0.1/CP/app/static/bower_components/seajs/dist/sea.js"></script>
     <script src="http://127.0.0.1/CP/app/static/bower_components/seajs/dist/seajs-css.js"></script>
     <script src="http://127.0.0.1/CP/app/static/bower_components/seajs/dist/seajs-text.js"></script>
     <script>

    var domain = 'http://127.0.0.1/CP/app',
        remoteResource = 'http://127.0.0.1/CP/app/static';

	seajs.config({

	      alias: {
                "lang" : "I18N/"+getLocale()+".js",
                "$" : "bower_components/zepto/zepto.min.js",
                "angular": "bower_components/angular/angular.js",
                "angular-route" : "bower_components/angular-route/angular-route.js"
	      },

          preload: [
                'lang','$','angular','angular-route'          
          ],

	      paths: {
		        'bower_components' : remoteResource+'/bower_components'
	      },

	      vars: {
                //目前是单站点，配置路径有些多，是方便日后多站点整合 资源按照类型分布式部署。
		        'locale': getLocale(),
                'resourceUrl': domain+'/resource/',
                'tpl': remoteResource+'/views/',
                'controllers': remoteResource+'/controllers/',
                'static': remoteResource+'/',
                'tools' : remoteResource+'/tools/',
                'components' : remoteResource+'/bower_components/', 
                'apiUrl': domain+'/apis/',
                'apiAccessUrl': domain+'/apis/'+getCookie('session_id')+'/'
	      },

          'map': [
                  [/^(.*\.(?:css|js))(.*)$/i, '$1?v='+Math.random()]
                  //[/^(.*\.(?:css|js))(.*)$/i, '$1?v=1.0']
          ],
                 
	      debug: true,
              
	      base: remoteResource+'/',
              
	      charset: 'utf-8'
	});

   
    function getLocale(){
          var locale = getCookie('siteLocale'); 
          return locale == '' ? 'en' : local;             
    };

    function getCookie(name) {
        var search = name + "=",offset,end; 
        if(document.cookie.length > 0) { 
            offset = document.cookie.indexOf(search);
            if(offset != -1) { 
                offset += search.length;
                end = document.cookie.indexOf(";", offset); 
                if(end == -1) {
                   end = document.cookie.length;
                };
                return decodeURI(document.cookie.substring(offset, end));
            } 
        }
        return "";
    };   

    //依赖加载，angular-router,依赖angular   
    seajs.use(['$','angular','lang'],function(){
        seajs.use(['angular-route'],function(){
            seajs.use(remoteResource+"/app");
        });
    })

    </script>
</html>
